home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _1E21C692CB2D4673BA2EE642C00A88B0 < prev    next >
Encoding:
Text File  |  2004-01-06  |  1.0 KB  |  37 lines

  1. // ===============================================================
  2. // Vertex Program: 
  3. // Description: 
  4. // Last Update: 14/08/2003
  5. // Coder: Andrey Honich
  6. // ===============================================================
  7.  
  8.       #include "../CGVPMacro.csi"
  9.  
  10.       VS20Only
  11.  
  12.       VertAttributes { POSITION_3 TEXCOORD0_2 TANG_3X3 }
  13.       MainInput { VIEWPROJ_MATRIX, LIGHT_POS, ATTEN }
  14.       DeclarationsScript
  15.       {
  16.         IN_T0_TANG
  17.         OUT_T0_T1_T2_T3_C0_C1
  18.       }
  19.       PositionScript = PosCommon
  20.       CoreScript
  21.       {
  22.         OUT.Tex0.xy = IN.TexCoord0.xy;
  23.         OUT.Tex1.xy = IN.TexCoord0.xy;
  24.  
  25.         TANG_MATR
  26.  
  27.         // store normalized light vector
  28.         float3 lightVec = mul(objToTangentSpace, LightPos.xyz - vPos.xyz);
  29.         
  30.         float3 vDist = PROC_ATTENPIX;
  31.         // transform light vector from object space to tangent space and pass it as a tex coords
  32.         OUT.Tex2.xyz = vDist;
  33.         OUT.Color.xyz = vDist;
  34.         
  35.         OUT.Tex3.xyz = lightVec;
  36.       }
  37.